package au.com.handsunited.model.notices;

import java.io.Serializable;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import au.com.handsunited.model.MotherOfAllEntities;

/**
 * @author Arun Chandrasekhar
 *
 */
public class Notice extends MotherOfAllEntities implements Comparable<Notice>, Serializable{

	private String title;
	private String text;
	private NoticeStatus status;
	private NoticeBoard noticeBoard;
	
	
	private static Logger logger = LoggerFactory.getLogger(Notice.class);


	public Notice() {
		super();
		status = NoticeStatus.ACTIVE;
	}
	
	public Notice(NoticeBoard noticeBoard) {
		this();
		this.noticeBoard = noticeBoard;
	}


	public Notice(String title, String text, NoticeBoard noticeBoard) {
		this(noticeBoard);
		this.title = title;
		this.text = text;
	}
	
	public void expireNotice() {
		setStatus(NoticeStatus.EXPIRED);
	}
	
	public void activateNotice() {
		setStatus(NoticeStatus.ACTIVE);
	}
	
	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getText() {
		return text;
	}

	public void setText(String text) {
		this.text = text;
	}

	public NoticeStatus getStatus() {
		return status;
	}

	public void setStatus(NoticeStatus status) {
		this.status = status;
	}	
	
	public NoticeBoard getNoticeBoard() {
		return noticeBoard;
	}

	public void setNoticeBoard(NoticeBoard noticeBoard) {
		this.noticeBoard = noticeBoard;
	}

	@Override
	public int compareTo(Notice notice) {
		return getDateCreated().compareTo(notice.getDateCreated());
	}

}
